<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<button type="button" onclick="alert('按钮1被按了')">按钮1</button>
		<button type="button" onclick="foo2()"> 按钮2</button>
		<button type="button" id="btn3">按钮3</button>
		<button type="button" id="btn4">按钮4</button>
		
		<script type="text/javascript">
			function foo2()
			{
				alert("按钮2被按了")
			}
			btn3.onclick=function()
			{
				alert("按钮3被按了")
			}
			btn4.addEventListener("click",function(){
				alert("按钮4被按了")
			},true)
			
			
		</script>
		
		
	</body>
</html>
